POV-Ray : Newsgroups : povray.programming : Why not generate parser with Bison & Flex? : Why not generate parser with Bison & Flex? Server Time
29 Jul 2024 02:24:20 EDT (-0400)
  Why not generate parser with Bison & Flex?  
From: Evan Powers
Date: 29 Dec 1998 21:43:01
Message: <36899335.0@news.povray.org>
As an in-my-free-time project I'm writing a structured database system that
lets remote users log into a server then read and edit the database. I've
created my own mini language for storing the database, and have discovered
that I really don't want to write a parser for it. It would probably be kind
of fun, but hey, I don't have the time. Anyway, I discovered the UNIX
utilities Bison and Flex, and the man pages tell me these utilities will
generate a lexer and parser for me from a "source" file containing the
language grammar. I've read most of Bison's info file, and it looks like
these utilities would make writing even a parser for the C & C++ programming
languages easy.

Soon after, what pops into my head? Something a friend working on his own
custom version of POV told me... something about weird macros in the
parser.... Anyway, I downloaded the source and took a look, and discovered
that, indeed, the parser consisted of cryptic code and lots of funny macros.

The point:

Has anyone considered redoing POV's parser entirely using Bison and Flex?
Making a language grammar file, from what I know, would be child's play
compared to understanding and changing the existing code. Plus it would make
maintaining the language grammar (and thus the parser) ridiculously easy.
Both programs are part of GNU (they're free with source like POV), and I
know that ports exist for Win32 and MS-DOS as well as UNIX, so lack of tools
isn't an excuse. It might even speed parse times, since parsers and lexers
made by these tools supposedly run at several hundred thousand lines per
minute for even complex languages.

I'd almost be willing to undertake the task myself, and might eventually if
no one else does, except I have lots of other, less recreational, things to
do. It seems like such an elegant solution in terms of ease of maintenance
and comprehension; I hope the POV development team looks into it.

--Evan Powers
EPT### [at] aolcom


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.